function tabFade(e, t,env) {
	e || t ? $(".tab-content", env).stop(!0).fadeIn(500) : $(".tab-content", env).stop(!0).fadeOut(20)
}
var func = {
	setBreadUrl: function(e) {
		var t = {
				products: {
					deep: 0,
					url: "/products/",
					title: "Products"
				},
				mill: {
					deep: 1,
					url: "/products/mill/",
					title: "Mill"
				},
				mine: {
					deep: 1,
					url: "/products/mine/",
					title: "Mine"
				},
				material: {
					deep: 1,
					url: "/products/material/",
					title: "Material"
				},
				aggregate: {
					deep: 1,
					url: "/products/aggregate/",
					title: "Aggregate"
				}
			},
			i = location.protocol + "//" + location.hostname,
			s = document.referrer || i + t.products.url,
			n = s.split("/"),
			a = "/" + n.slice(3).join("/");
		$.each(t, function() {
			var t = "";
			1 == this.deep && this.url == a && (t += "<li><a href='" + this.url + "'>" + this.title + "</a></li>"), $(t).insertAfter($(e).children("li").eq(1))
		})
	},
	setBarFixed: function(e) {
		function t() {
			var e = $(window).scrollTop();
			a.length > 0 ? i(e) : s(e), c = e, d = !1
		}

		function i(e) {
			var t = a.offset().top - r.height() - o.height();
			c >= e ? e < t ? (o.removeClass("is-hidden").removeClass("header-fixed"), r.removeClass("fixed slide-up"), a.removeClass("secondary-nav-fixed"), $(".bread-title", ".bread-nav").addClass("hide")) : c - e > h && (r.removeClass("slide-up").addClass("fixed"), a.addClass("secondary-nav-fixed"), $(".bread-title", ".bread-nav").removeClass("hide")) : e > t + u ? (r.addClass("fixed slide-up"), a.addClass("secondary-nav-fixed")) : e > t && (r.addClass("fixed").removeClass("slide-up"), a.addClass("secondary-nav-fixed"))
		}

		function s(e) {
			c - e > h ? (o.removeClass("is-hidden"), o.css("top", -$("#header").scrollTop())) : e - c > h && e > u && o.addClass("is-hidden")
		}
		var n = $(e),
			a = n.siblings(".tab-content"),
			o = (n.offset().top + n.height(), $("#header-nav")),
			r = $("#fixed-nav"),
			l = o.height(),
			c = ($("#header").height(), 0),
			d = !1,
			h = 10,
			u = 150;
		$(window).on("scroll", function() {
			d || (d = !0, window.requestAnimationFrame ? requestAnimationFrame(t) : setTimeout(t, 250))
		}).trigger("scroll"), $(window).on("resize", function() {
			l = o.height()
		})
	},
	scrollTop: function(e) {
		function t() {
			$(window).scrollTop() > i ? $(e).fadeIn() : $(e).fadeOut()
		}
		var i = 1.5 * $(window).height();
		t(), $(window).on("scroll", t), $(e).on("click", function(e) {
			e.preventDefault(), !$("body,html").is(":animated") && $("body,html").animate({
				scrollTop: 0
			}, 1e3)
		})
	},
	canvasDraw: function(e, t) {
		function i() {
			function i(e, t, i) {
				e.save(), e.beginPath(), e.arc(centerX, centerY, 70, -Math.PI / 2, -Math.PI / 2 + t * i, !1), e.globalCompositeOperation = "source-atop", e.strokeStyle = "#2e99eb", e.lineWidth = 10, e.lineCap = "round", e.stroke(), e.closePath(), e.restore()
			}
			var s = 0,
				n = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame,
				a = window.cancelAnimationFrame || window.mozCancelAnimationFrame || window.webkitCancelAnimationFrame || window.msCancelAnimationFrame;
			n && a || (n = function(e, t) {
				var i = (new Date).getTime(),
					n = Math.max(0, 16 - (i - s)),
					a = window.setTimeout(function() {
						e(i + n)
					}, n);
				return s = i + n, a
			}, a = function(e) {
				window.clearTimeout(e)
			}), $(e, t).each(function() {
				function e() {
					i(f, s, rad), s += t, o = n(e), s > h && a(o)
				}
				var t = 2,
					s = 0,
					o = null,
					r = $.trim($(this).data("text")),
					l = r.split(","),
					c = l[0],
					d = l[1],
					h = parseInt(l[2]),
					u = this,
					f = u.getContext("2d");
				centerX = u.width / 2, centerY = u.height / 2, rad = 2 * Math.PI / 360, f.save(), f.beginPath(), f.strokeStyle = "#eee", f.lineWidth = 10, f.arc(centerX, centerY, 70, 0, 2 * Math.PI, !1), f.stroke(), f.closePath(), f.textAlign = "center", f.textBaseline = "middle", f.fillStyle = "#2e99eb", f.font = "30px 寰蒋闆呴粦", f.fillText(c, centerX, centerY), f.fillStyle = "#c0c0c0", f.font = "20px 寰蒋闆呴粦", f.fillText(d, centerX, centerY + 30), f.restore(), n(e)
			})
		}
		var s = $(window),
			n = (1.1 * s.height(), $("#header"));
		s.on("scroll", function() {
			!$(this).data("draw") && s.scrollTop() >= 1.1 * n.outerHeight() && (i(), $(this).data("draw", new Date))
		})
	},
	leaveMsg: function() {
		var e = $("<div class='overlay-mask'></div>"),
			t = $(".aftersale"),
			i = t.find(".overlay"),
			s = $(".btn_needs_submit");
		s.on("click", function(s) {
			s.preventDefault(), t.prepend(e), i.show().animate({
				opacity: "1"
			}, 800)
		}), e.on("click", function(t) {
			t.stopPropagation(), i.hide().animate({
				opacity: "0"
			}, 800), e.detach()
		})
	},
	breadNavResize: function(e) {
		$(window).on("resize", function() {
			$(this).width() > 767 ? $(e).css("height", "auto") : $(e).removeAttr("style")
		})
	},
	checkSelector: function(e) {
		return $(e).length > 0
	},
	getFunc: function() {
		var e = this;
		return funDir = {
			setBarFixed: {
				s: "#fixed-nav",
				f: e.setBarFixed,
				p: ["#fixed-nav"]
			},
			setBreadUrl: {
				s: ".breadcrumb",
				f: e.setBreadUrl,
				p: [".breadcrumb"]
			},
			scrollTop: {
				s: ".f-top",
				f: e.scrollTop,
				p: [".f-top"]
			},
			canvasDraw: {
				s: ".degree canvas",
				f: e.canvasDraw,
				p: ["canvas", ".degree"]
			},
			leaveMsg: {
				s: ".aftersale",
				f: e.leaveMsg,
				p: 0
			},
			breadNavResize: {
				s: "#pronav",
				f: e.breadNavResize,
				p: ["#pronav"]
			}
		}
	}
};
$.each(func.getFunc(), function() {
		func.checkSelector(this.s) && (this.p ? this.f.apply(this, this.p) : this.f())
	}),
	function(e) {
		function t(t, s) {
			this.elem = t, this.settings = e.extend(!0, i, s || {}), this.selector = this.settings.selector, this.index = this.settings.index, this.listLen = this.sEk(), this.listHeight = this.sEj(), this.duration = this.settings.duration, this.loop = this.settings.loop, this.autoTimer = null, this.canScroll = !0
		}
		e.fn.scrollList = function(i) {
			return this.each(function() {
				var s = e(this).data("scrollList");
				s || (s = new t(this, i), e(this).data("scrollList", s)), s.sEa()
			})
		};
		var i = {
			selector: {
				wrapInner: "ul",
				scrollList: "li",
				prev: ".s_prev",
				next: ".s_next"
			},
			index: 0,
			speed: 500,
			duration: 3e3,
			loop: !0,
			autoPlay: !0,
			seamless: !0
		};
		t.prototype = {
			sEa: function() {
				var t = this;
				t.sEb(), e(this.selector.prev).on("click", function(e) {
					e.preventDefault(), t.sEc()
				}), e(this.selector.next).on("click", function(e) {
					e.preventDefault(), t.sEd()
				}), this.settings.seamless && e(this.selector.wrapInner, this.elem).clone().appendTo(this.elem), e(this.elem).on("mouseover", function() {
					t.sEi()
				}).on("mouseout", function() {
					t.sEh()
				}), this.settings.autoPlay && this.sEh()
			},
			sEb: function() {
				this.index = this.index <= this.listLen - 1 ? this.index : 0, e(this.elem).css("marginTop", -this.listHeight * this.index)
			},
			sEc: function() {
				this.canScroll && this.index--, !this.loop && 0 > this.index && (this.index = 0), this.loop && 0 > this.index && (this.index = 2 * this.listLen - 1), this.sEf()
			},
			sEd: function() {
				this.canScroll && this.index++, !this.loop && this.index > this.listLen - 1 && (this.index = this.listLen - 1), this.loop && this.index > 2 * this.listLen - 1 && (this.index = 0), this.sEf()
			},
			sEf: function() {
				var t = this;
				t.sEl(), t.sEi(), t.canScroll && e(t.elem).animate({
					marginTop: -t.listHeight * t.index
				}, t.speed, function() {
					t.canScroll = !0, t.sEg(), t.sEh()
				})
			},
			sEg: function() {
				this.settings.seamless && (0 == this.index && (this.index = this.listLen, e(this.elem).css("marginTop", -this.listHeight * this.index)), this.index == 2 * this.listLen - 1 && (this.index = this.listLen - 1, e(this.elem).css("marginTop", -this.listHeight * this.index)))
			},
			sEh: function() {
				var e = this;
				e.autoTimer = e.settings.autoPlay && setInterval(function() {
					e.sEd()
				}, e.duration)
			},
			sEi: function() {
				this.autoTimer && clearInterval(this.autoTimer)
			},
			sEj: function() {
				return e(this.selector.scrollList, this.elem).height()
			},
			sEk: function() {
				return e(this.selector.scrollList, this.elem).length
			},
			sEl: function() {
				e(this.elem).is(":animated") ? this.canScroll = !1 : this.canScroll = !0
			}
		}
	}(jQuery), $(".jq_scroll").scrollList(), $("#pronav", ".series").children("li").eq(5).remove();

var isIn = !1,
	isInTab = !1;
$(".jq_tab_fade").children().each(function() {
	var e = $(this).children().data("fade");
    var env = "#"+$(this).data('env');

	$(this).on("mouseover", function() {
		isInTab = !0, $(this).addClass("active").siblings().removeClass("active"), $(e).addClass("active").stop(!0).fadeIn().siblings().fadeOut().removeClass("active"), tabFade(isIn, isInTab,env)
	}).on("mouseleave", function() {
		isInTab = !1, tabFade(isIn, isInTab,env)
	})

}); $(".tab-content", ".jq_tab").on("mouseleave", function() {
    var env = "#"+$(this).data('env');
	isIn = !1, tabFade(isIn, isInTab,env);
}).on("mouseenter", function() {
    var env = "#"+$(this).data('env');
	isIn = !0, tabFade(isIn, isInTab,env)
});
var jModule = function(e, t, i) {
		"use strict";
		return {
			jAs: function(e, i, s) {
				var n = t.createElement(e);
				return "script" === e ? (n.src = i, n.setAttribute("async", "async"), s && "function" == typeof s && (n.onload = s), t.getElementsByTagName("head")[0].appendChild(n)) : "link" === e && (n.rel = "stylesheet", n.href = i, t.getElementsByTagName("head")[0].appendChild(n)), this
			},
			jBs: function() {
				var e = window.getComputedStyle(document.documentElement, "");
				return pre = (Array.prototype.slice.call(e).join("").match(/-(moz|webkit|ms)-/) || "" === e.oLink && ["", "o"])[1], pre
			},
			jCs: function(e, t, i) {
				return e.test(t) && i && "function" == typeof i && i(), this
			},
			jDs: function() {
				var e = "";
				e = location.href.indexOf("mill") > 0 ? "/case/mill" : location.href.indexOf("aggregate") > 0 ? "/case/aggregate" : location.href.indexOf("mine") > 0 ? "/case/mine" : location.href.indexOf("material") > 0 ? "/case/material" : "/casedata", i.get(e + ".json?t=" + Math.random(), function(e) {
					var t = i(".filter-item", ".jq_sort"),
						s = typeof e === 'object' ? e : $.parseJSON(e);
					i.each(t, function(e, t) {
						var n = i.trim(i(this).text());
						e.toString().replace(/[\s\.-\/]+/g, "");
						s[n] && "string" == typeof s[n] ? i(this).attr("data-filter", s[n]) : "object" == typeof s[n] && s[n].hasOwnProperty("filter") && i(this).attr("data-filter", s[n].filter)
					})
				})
			}
		}
	}(window, document, jQuery);

var pattern = /[\w-\d]+\.html/,
    url = location.href.substring(location.href.indexOf("products/")+9);
jModule.jCs(pattern,url,function(){
    jModule.jAs('script','http://static.sbmchina.com/js/layer.js',function(){
        layer.ready(function(){
            layer.photos({
                photos: '.pro-gallery'
            });
        })
    }).jAs('script','http://static.sbmchina.com/js/table.js').jAs('script','http://static.sbmchina.com/js/share.js');
});

var millPage = /.+?\/case\/$/;
jModule.jCs(millPage, location.href, function() {
	jModule.jAs("script", "http://static.sbmchina.com/js/filter.js", function() {
		jModule.jDs()
	}).jAs("script", "http://static.sbmchina.com/js/selectLoad.js").jAs("script", "http://static.sbmchina.com/js/infinite-scroll/jquery.infinitescroll.js", function() {
		var e = $("#case_list");
		e.infinitescroll({
			navSelector: "#page_nav",
			nextSelector: "#page_nav a",
			itemSelector: ".filter-item",
			animate: !0,
			dataType: "html",
			loading: {
				finishedMsg: "<em>No More</em>",
				img: "/js/infinite-scroll/img/ajax-loader1.gif",
				msgText: "<em>Loading...</em>",
				speed: "slow"
			}
		}, function(e) {
			jModule.jDs()
		})
	})
}), $(".bread-toggle").on("click", function() {
	$(this).find("span").eq(0).toggleClass("hover")
});